﻿//////////////////////////////////////////////////////////////////////////////
//
//  Copyright © 1998-2024 Glodon Company Limited.  All rights reserved.
//
//  Use of this software is subject to the terms of the Glodon license
//  agreement provided at the time of installation or download, or which
//  otherwise accompanies this software in either electronic or hard copy form.  
//
//////////////////////////////////////////////////////////////////////////////


#pragma once
#include "GnufValueInput.h"
#include "GnufCheckGroupControl.h"

namespace gnuf {
    class GNUF_BASE_EXPORT BoolValueInputGroup
        : public ValueInput<std::pair<int,bool>>
        , public ICheckGroupControlHandler
    {
        DEFINE_CAST_DERIVED(gnuf::BoolValueInputGroup, gnuf::ValueInputBase)
    public:
        explicit BoolValueInputGroup(std::uint16_t, int, std::vector< gcmp::OwnerPtr< Info > >& , ECheckGroupStyle, gcmp::OwnerPtr< Info > &);
        explicit BoolValueInputGroup(std::uint16_t, std::vector< gcmp::OwnerPtr< Info > >&,const std::vector<bool>&, ECheckGroupStyle, gcmp::OwnerPtr< Info >&);

        virtual ~BoolValueInputGroup();
        inline const CheckGroupControl* checkGroupControl() const { return m_checkGroupCtrl.get(); }
        inline       CheckGroupControl* checkGroupControl()       { return m_checkGroupCtrl.get(); }
        inline bool IsExclusive() { return m_exclusive; }
    protected:
        // Inherits from ValueInput...
        virtual void onPostValueChanged() override;
        virtual void onPostAbilityChanged() override;

        // Inherits from ICheckGroupControlHandler...
        virtual std::pair<int,bool> onGetCheckState() const { return value(); }
        virtual void onCurrentIndexChanged(int) override;
        virtual void onCheckStatusChanged(int, bool) override;
    private:
        gcmp::OwnerPtr< CheckGroupControl > m_checkGroupCtrl;
        bool m_exclusive;
    };

}
